int minMoves(vector<int> &nums)
{
    int sum = 0, min = nums[0];
    for (int i = 1; i < nums.size(); i++)
    {
        if (min > nums[i])
            min = nums[i];
    }
    for (int i = 0; i < nums.size(); i++)
    {
        sum += nums[i] - min;
    }
    return sum;
}